package com.SH.service.impl;

import com.SH.mapper.ShoppingMapper;
import com.SH.pojo.Shopping;
import com.SH.service.ShoppingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoppingServiceImpl implements ShoppingService {


    @Autowired
    private ShoppingMapper shoppingMapper;

    @Override
    public List<Shopping> getAll() {
        List<Shopping> shoppings = shoppingMapper.getAll();
        return shoppings;
    }

    @Override
    public List<Shopping> getByUid(Integer uid) {
        List<Shopping> shoppings = shoppingMapper.getByUid(uid);
        return shoppings;
    }

    @Override
    public Integer addCar(Integer uid, Integer gid) {
        return shoppingMapper.addCar(uid,gid);
    }

    @Override
    public Boolean deleteGood(Integer id) {
        return shoppingMapper.deleteGood(id);
    }

    @Override
    public Shopping getById(Integer id) {
        Shopping shopping = shoppingMapper.getById(id);
        return shopping;
    }

    @Override
    public Boolean buyGoods(Integer id) {
        return shoppingMapper.buyGoods(id);
    }

    @Override
    public List<Shopping> getBought(Integer uid) {
        List<Shopping> bought = shoppingMapper.getBought(uid);
        return bought;
    }

    @Override
    public List<Shopping> getByUIdAndGid(Integer uid, Integer gid) {
        List<Shopping> list = shoppingMapper.getByUIdAndGid(uid, gid);
        return list;
    }
}
